import pandas as pd
from flask import Flask, render_template

# df = pd.read_csv('data/房源数量占比.csv')
# df = df.sort_values('房源数量分布占比', ascending=False)
# province = df['省份'].head(5).tolist()
# rank = df['房源数量分布占比'].head(5).tolist()

datas = {}
df = pd.read_csv('data/房源数量占比.csv')
df = df.sort_values('房源数量分布占比', ascending=False)

for item in df.head().values:
    datas[item[0]] = item[1]

app = Flask(__name__)


@app.route('/')
def index():
    return render_template('房源占比前五的饼图.html', datas=datas)


if __name__ == '__main__':
    app.run(debug=True)
